package com.example.week1_home01;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import android.content.Intent;

public class MainActivity extends AppCompatActivity {
    Button button1;
    Button button2;
    Button button3;
    Button button4;
    Button btn_simple_listview;

/*
OnClickListener是View类里面的一个接口
View.OnClickListener(){}-----定义一个匿名类
new 匿名类-----实例化类一个对象，这个对象自然是View.OnClickListener的子类
 */
     //private View.OnCreateContextMenuListener listener=new View.OnClickListener() {
    //监听事件
    //@Override

    //public void onClick(View v) {
       // Intent intent = new Intent(MainActivity.this, ActivityListView.class);
       // startActivity(intent);
  //  }
//}

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_first);
        Button button1=(Button) findViewById(R.id.button_1);
        Button button2=(Button) findViewById(R.id.button_2);
        Button button3=(Button) findViewById(R.id.button_3);
        Button button4=(Button) findViewById(R.id.button_4);
        //Button buttonbtn_simple_listview=(Button) findViewById(R.id.btn_simple_listview);

        button4.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, ActivitySecond.class);
                startActivity(intent);
                //setContentView(R.layout.activity_second);当前页面
            }
        });
        button3.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, ActivityThrid.class);
                startActivity(intent);
            }
        });
    }
}
